﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ControlNode
{
    class Logger
    {
        public static ListBox listBox1;
        public static Form form;
        private delegate void SetTextCallback(string text);

        public static void SetText(string text)
        {
            

            if (listBox1.InvokeRequired)
            {
                SetTextCallback d = SetText;
                form.Invoke(d, new object[] { text });
            }
            else
            {
                DateTime current = DateTime.Now;
                listBox1.Items.Add("[ " + current.ToString() + " ]   " + text);
            }
        }
    }
}
